#!/usr/bin/env bash
# vim: fdm=marker fmr=[[[,]]] cms=\ #%s

#[[ -z $SOAR ]] && SOAR=/opt/soar
#PATH=$PATH:$SOAR/common/bash/soar
PATH=$PATH:../../soar
. soar.sh

main()
{
    local cnfg_file=sample.cnfg
    local value

    value=$(cnfg_get_property $cnfg_file GLOBAL NOTEXIST)
    if [[ -z $value ]]
    then
        echo "Property:NOTEXIST not found"
    fi
    value=$(cnfg_get_property $cnfg_file GLOBAL DEBUG)
    echo "DEBUG = $value"
    value=$(cnfg_get_property $cnfg_file GLOBAL HOST)
    echo "HOST = $value"
    echo

    value=$(cnfg_get_property $cnfg_file SERVER SVR_TEST1)
    echo "SVR_TEST1 = $value"
    value=$(cnfg_get_subproperty $cnfg_file SERVER SVR_TEST1 ID)
    echo "SVR_TEST1.ID = $value"
    value=$(cnfg_get_subproperty $cnfg_file SERVER SVR_TEST1 ARG)
    echo "SVR_TEST1.ARG = $value"
    echo

    cnfg_property_array $cnfg_file SERVER
}

main $@
exit $?
